import {
    ProduceRecord
} from './../domain/model';

import { DataContextFactory, FBSDataContextBase } from '../domain/fbsDataContext';
import { Response, ServiceConfig, route, Guid } from '../common';
import { ServiceException } from "./serviceException";
import { Transaction } from "tiny-entity";


export class ProduceRecordService {
    private ctx: FBSDataContextBase;
    constructor() {
        this.ctx = DataContextFactory.GetDataContext();
    }



    /**
     * 生成一条制作记录
     * 
     * @param {ProduceRecord} record 
     * @returns 
     * 
     * @memberof FrontStoreStockService
     */
    @Transaction(DataContextFactory.GetDataContext())
    async createProduceRecord(record: ProduceRecord) {
        record.id = Guid.GetGuid();
        record.createTime = new Date().getTime();
        let data = await this.ctx.Create(record);
        return data;
    }
}